/**
 * Created by Administrator on 2017/4/12 0012.
 */
import axios from 'axios';
import {ALL_SERVICE_API} from '../api';
var qs = require('qs');

export const getCoupons = params => {
  return axios.get(ALL_SERVICE_API + `/couponVOs`, {params: params});
};

export const saveCoupons = (params) => {
  return axios.post(ALL_SERVICE_API + `/coupons`, params);
};

// 批量删除/api/v2.0/admin/coupons/{id}
export const batchCoupons = ids => {
  return axios.delete(ALL_SERVICE_API + `/coupons/` + ids);
};
// 发布
export const publishDiscount = (id, status) => {
  return axios.post(ALL_SERVICE_API + `/coupons_modify_status`, qs.stringify({id: id, status: status}));
};

// 领用记录列表
export const getReceiveList = params => {
  return axios.get(ALL_SERVICE_API + '/coupons/' + params.id + '/coupon_logs', {params: params});
  // return axios.get(baseURL+'/coupon_logs/'+id);
};
